<template>
	<view>
		<uni-list>
		    <uni-list-item v-for="(item,index) in list" :key="index" clickable 
			  :title="item.context" :rightText="item.date" @click="onShowNote()"></uni-list-item>
		    
		</uni-list>
		<view class="plus" @click="openForm()">
			+
		</view>
	</view>
</template>

<script>
	import DB from '@/common/sqlite.js'
	export default {
		data() {
			return {
				//读后感内容
				list:[]
			}
		},
		onLoad() {
			//如果表不存在，则创建表myNote
			DB.createTable('myNote','ID integer PRIMARY KEY AUTOINCREMENT , date TEXT,context TEXT');
			
			
		},
		onShow() {
			console.log('来到了note页面')
			DB.selectTableData('myNote').then(res=>{
				console.log("sqllite_data",res);
				this.list=res
			}); 
		},
		methods: {
			//显示详情
			onShowNote(){
				
			},
			//打开写读后感
			openForm(){
				uni.navigateTo({
					url:'form/form'
				})
			}
		}
	}
</script>

<style>
.plus{
	text-align: center;
	background-color: #1972e7;
	width: 100rpx;
	height: 100rpx;
	border-radius: 100%;
	color: aliceblue;
	font-size: 80rpx;
	line-height: 80rpx;
	position: fixed;
	bottom: 200rpx;
	left: 330rpx;
	 /* x偏移量 | y偏移量 | 阴影模糊半径 | 阴影扩散半径 | 阴影颜色 */
	box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2) ;
}
</style>
